Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR replaces broad question/instruction regex rules with more precise, start-anchored ChatGPT query patterns for a wider set of verbs and adds Go tests to verify that the ChatGPT routing regex only matches at the start of a query.
- Replaces legacy unanchored ChatGPT regex entries with multiple
^(verb)\brules in bothnginx.confand its template. - Adds
nginx_regex_test.goto extract the generated regexes and test that matches occur only at the beginning of input and not elsewhere. - Ensures all regex lines remain under 80 characters.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| nginx.conf | Replaced question/instruction mappings with anchored ChatGPT verb rules |
| cmd/sea/nginx_regex_test.go | Added helper to parse the config and tests for start-of-query matching |
| cmd/sea/nginx.conf.tmpl | Updated template to include the same anchored ChatGPT query rules |
Comments suppressed due to low confidence (1)
cmd/sea/nginx_regex_test.go:68
- Consider adding tests for case-insensitive matching (e.g., uppercase verbs) and punctuation boundaries to ensure the regex truly behaves as expected under different input scenarios.
for _, w := range words {
| var patterns []string | ||
| lines := strings.Split(conf, "\n") | ||
| inBlock := false | ||
| re := regexp.MustCompile(`~\*\(\?i\)\^([^\\]+)\\b\s+chatgpt;`) |
There was a problem hiding this comment.
[nitpick] The variable name re is quite generic; consider renaming it to something more descriptive like ruleRegex for better readability.
Suggested change
| re := regexp.MustCompile(`~\*\(\?i\)\^([^\\]+)\\b\s+chatgpt;`) | |
| ruleRegex := regexp.MustCompile(`~\*\(\?i\)\^([^\\]+)\\b\s+chatgpt;`) |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Testing
go test ./...docker compose up -d(fails:dockernot found)https://chatgpt.com/codex/tasks/task_b_686c225b7d1c832ab5c7707b61e8d526